home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / estra.lha / estra / src / Tree.ast < prev    next >
Text File  |  1992-08-18  |  3KB  |  154 lines

  1. /* $Id: Tree.ast,v 2.4 1992/08/07 15:47:56 grosch rel $ */
  2.  
  3. TREE IMPORT    {
  4.  
  5. FROM Idents    IMPORT    tIdent;
  6. FROM IO        IMPORT    tFile;
  7. FROM Environs    IMPORT    tFunction;
  8. FROM Patterns    IMPORT    tPattern;
  9. FROM Positions    IMPORT    tPosition;
  10. FROM Sets    IMPORT    tSet;
  11. FROM StringMem    IMPORT    tStringRef;
  12. FROM SYSTEM    IMPORT    ADDRESS;
  13.  
  14. TYPE
  15.   tSelMode = (cNoSel, cSel, cTreeSel);
  16.   yyEstra = ADDRESS;
  17. }
  18.  
  19. GLOBAL    {
  20. FROM Idents    IMPORT    tIdent;
  21. FROM Positions    IMPORT    tPosition;
  22. FROM IO        IMPORT    tFile, WriteI, WriteS, WriteNl;
  23. FROM StringMem    IMPORT    tStringRef, WriteString;
  24. }
  25.  
  26. RULE
  27.  
  28. spec        = <
  29.   Spec        =    [name:    tIdent]        [pos:    tPosition]
  30.             [grna:    tIdent]        [grpos: tPosition]
  31.             export: code
  32.             global: code
  33.             begin:    code
  34.             close:    code
  35.             classes
  36.             functions .
  37. > .
  38.  
  39. classes        = <
  40.   Class0    = .
  41.   Class        =    [suid:    tIdent]        [supos:    tPosition]
  42.             [clid:    tIdent]        [clpos:    tPosition]
  43.             nodes
  44.             classes        REVERSE
  45.             [correct: BOOLEAN] .
  46. > .
  47.  
  48. nodes        = <
  49.   Node0        = .
  50.   Node        =    [name:    tIdent]        [napos:    tPosition]
  51.             [ident:    tIdent]        [idpos:    tPosition]
  52.             sons
  53.             nodes        REVERSE
  54.             [correct: BOOLEAN] .
  55. > .
  56.  
  57. sons        = <
  58.   Son0        = .
  59.   Son        =    [name:    tIdent]        [napos:    tPosition]
  60.             [ident:    tIdent]        [idpos:    tPosition]
  61.             sons        REVERSE
  62.             [correct: BOOLEAN] .
  63. > .
  64.  
  65. attributes    = <
  66.   Attribute0    = .
  67.   Attribute    =    [ident:    tIdent]        [idpos:    tPosition]
  68.             [mod:    tIdent]        [mopos:    tPosition]
  69.             [type:    tIdent]        [typos: tPosition]
  70.             attributes    REVERSE .
  71. > .
  72.  
  73. functions    = <
  74.   Function0    = .
  75.   Function    =    [name:    tIdent]        [napos:    tPosition]
  76.             in: attributes
  77.             out: attributes
  78.             result
  79.             domain
  80.             directives
  81.             functions    REVERSE
  82.             ->
  83.             [funct: tFunction] [domainset: tSet] .
  84. > .
  85.  
  86. result        = <
  87.   NoResult    = .
  88.   Type        =    [mod:    tIdent]        [mopos:    tPosition]
  89.             [type:    tIdent]        [typos: tPosition] .
  90. > .
  91.  
  92. domain        = <
  93.   Ident0    = .
  94.   Ident        =    [ident:    tIdent]        [idpos: tPosition]
  95.             domain        REVERSE .
  96. > .
  97.  
  98. directives    = <
  99.   Directive0    = .
  100.   Directive    =    pattern
  101.             condition
  102.             costs
  103.             decl:    code
  104.             instr:    code
  105.             directives    REVERSE
  106.             [correct: BOOLEAN]
  107.             ->
  108.             [number: INTEGER]
  109.             [pat: tPattern]        [iter: BOOLEAN] .
  110. > .
  111.             
  112. pattern        =    [pos: tPosition] <
  113.   Pattern1    =    [sel:    tIdent]        [sepos: tPosition]
  114.             [ident:    tIdent]        [idpos: tPosition]
  115.             [correct: BOOLEAN] .
  116.   Pattern    =    [sel:    tIdent]        [sepos: tPosition]
  117.             [ident:    tIdent]        [idpos: tPosition]
  118.             patterns        [correct: BOOLEAN] .
  119. > .
  120.  
  121. patterns    = <
  122.   Patterns0    = .
  123.   Patterns    =    pattern
  124.             patterns    REVERSE .
  125. > .
  126.  
  127. condition    = <
  128.   CondD        = .
  129.   CondF        =    code .
  130. > .
  131.  
  132. costs        = <
  133.   CostD        = .
  134.   CostN        =    [value:    INTEGER]    [vapos:    tPosition] .
  135.   CostF        =    code .
  136. > .
  137.  
  138. code        =    [pos: tPosition] <
  139.   CdStr        =    [ident: tIdent]        code REVERSE
  140.             -> [mode: tSelMode] .
  141.   CdId        =    [ident: tIdent]        code REVERSE
  142.             -> [mode: tSelMode] .
  143.   CdDot        =    code REVERSE .
  144.   CdComma    =    code REVERSE .
  145.   CdLPar    =    code REVERSE .
  146.   CdRPar    =    code REVERSE .
  147.   CdLBra    =    code REVERSE .
  148.   CdRBra    =    code REVERSE .
  149.   CdSpa        =    [ref: tStringRef]    code REVERSE .
  150.   CdCom        =    [ref: tStringRef]    code REVERSE .
  151.   CdRst        =    [ref: tStringRef]    code REVERSE .
  152.   CdEnd        = .
  153. > .
  154.